Skip to main content

resize

resize(matrix: any[] | Mat | Tensor, sizes: any[], defaultValue : number) : any[] | Mat | Tensor

param matrix - an Array, Mat or Tensor - the construct to be resized

param sizes a 1-D Array (list) to resize to

param defaultValue a number for filling the remaining empty spaces

returns - any[] | Mat | Tensor - a resized Array, Mat or Tensor with the corresponding size given in sizes

sizes should be something like [2, 2, 2] or [2, -1]. Here, -1 means automatically matching.

resize and reshape are very similar. Here is an example for clarity: